home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Freeware / Utilitare / DesktopSidebar / Plugins / NotesEditor.DSPACKAGE / Source Code / plugin.cs < prev    next >
Encoding:
Text File  |  2004-07-08  |  2.2 KB  |  108 lines

  1. using System;
  2. using System.Drawing;
  3. using System.IO;
  4. using System.Reflection;
  5. using System.Resources;
  6. using System.Runtime.InteropServices;
  7. using System.Windows.Forms;
  8. using DesktopSidebar;
  9.  
  10.  
  11. namespace NotesEditor
  12. {
  13.     public class Plugin :
  14.         IPlugin,
  15.         IPanelCreator
  16.     {
  17.         public Plugin()
  18.         {
  19.         }
  20.     
  21.         public void Unload()
  22.         {
  23.         }
  24.  
  25.         public void OnPluginLoaded(string plugin)
  26.         {
  27.         }
  28.  
  29.         public void Load(
  30.             out string author, 
  31.             out string authorEMail, 
  32.             out string description, 
  33.             out string homepage, 
  34.             int sidebarBuild,
  35.             Sidebar Sidebar, 
  36.             IXmlNode pluginConfig, 
  37.             int pluginCookie)
  38.         {
  39.             author = "yyy based on DS SDK Sticker Panel";
  40.             authorEMail = "";
  41.             description = "Notes Editor";
  42.             homepage = "";
  43.             
  44.         ImageList imageList= new ImageList();
  45.         
  46.             Icon ico1 = null;
  47.             Icon ico2 = null;
  48.  
  49.             try
  50.             {
  51.                 Assembly thisExe; 
  52.                 thisExe = Assembly.GetExecutingAssembly();
  53.  
  54.                 string[] resnames = thisExe.GetManifestResourceNames();
  55.  
  56.                 Stream str1 = thisExe.GetManifestResourceStream("Icon.ico");
  57.                 ico1 = new Icon(str1, 16, 16);
  58.                 str1.Close();
  59.                 imageList.Images.Add(ico1);
  60.  
  61.                 Stream str2 = thisExe.GetManifestResourceStream("Plugin.ico");
  62.                 ico2 = new Icon(str2, 16, 16);
  63.                 str2.Close();
  64.                 imageList.Images.Add(ico2);
  65.             }
  66.             catch(Exception e)
  67.             {
  68.                 MessageBox.Show(e.Message, "NotesEditor");
  69.             }
  70.  
  71.             Sidebar.RegisterPanel(
  72.                 "NotesEditor",
  73.                 "Notes Editor",
  74.                 "Notes Editor",
  75.                 (int)imageList.Handle,
  76.                 "0",
  77.                 "Accessories",
  78.                 "1",
  79.                 "",
  80.                 "",
  81.                 pluginCookie);
  82.         
  83.             imageList.Dispose();
  84.  
  85.             if (ico1 != null)
  86.                 ico1.Dispose();
  87.             if (ico2 != null)
  88.                 ico2.Dispose();
  89.         }
  90.  
  91.         private void InitializeComponent()
  92.         {
  93.             // 
  94.             // Plugin
  95.             // 
  96.  
  97.         }
  98.         
  99.         public void CreatePanel(ref IPanel panel, string panelClass)
  100.         {
  101.             if (panelClass=="NotesEditor")
  102.             {
  103.                 panel=new NotesEditor.Panel();
  104.             }
  105.         }
  106.     }
  107. }
  108.